<!doctype html>
<html lang="">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
    <style></style>
  </head>
  <body>
    <div id="app">
      <button @click="obj.words+='33'">改变对象属性</button>
      <button @click="list.push({id:3})">改变数组</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          list: [{ id: 0 }, { id: 1 }, { id: 2 }],
          obj: {
            words: '苹果',
            age: 19,
          },
        },
        watch: {
          // 数据.push pop shift unshift splice sort everse不需要开深度监听
          list(newV, oldV) {
            console.log('newV ---> ', newV)
          },
          'obj.words'(newV, oldV) {
            console.log('newV ---> ', newV)
          },
        },
      })
    </script>
  </body>
</html>
